package cn.com.config;

import cn.com.interceptors.SecurityIntercopter;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Resource
    private SecurityIntercopter securityIntercopter;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration interceptor = registry.addInterceptor(securityIntercopter);
        interceptor.addPathPatterns("/recommend");
        interceptor.addPathPatterns("/prediction");
        interceptor.addPathPatterns("/compare/college");
        interceptor.addPathPatterns("/user/userinfo");
        interceptor.excludePathPatterns("/error","/logout","/account/login","/layui/**");
        interceptor.excludePathPatterns("/**/*.js");
        interceptor.excludePathPatterns("/**/*.css");
        interceptor.excludePathPatterns("/**/*.jpg");
        interceptor.excludePathPatterns("/**/*.png");
        interceptor.excludePathPatterns("/**/*.bmp");
        interceptor.excludePathPatterns("/**/*.gif");
        interceptor.excludePathPatterns("/**/*.ttf");
        interceptor.excludePathPatterns("/**/*.eot");
        interceptor.excludePathPatterns("/**/*.svg");
        interceptor.excludePathPatterns("/**/*.woff");
        interceptor.excludePathPatterns("/**/*.woff2");
    }
}
